package com.test.VT.CreateVT;

import com.test.VT.Thread.CustomThread;

/**
 * 创建虚拟线程
 * @author caoqianfan
 * @date 2024/9/27 14:03
 */
public class By_OfVirtual {
    public static void main(String[] args) {
        CustomThread customThread = new CustomThread();
        // 创建并且不启动虚拟线程，然后 unStarted.start()方法启动虚拟线程
        Thread unStarted = Thread.ofVirtual().unstarted(customThread);
        unStarted.start();
        // 等同于
        Thread.ofVirtual().start(customThread);
    }
}